package generic;

import generic.activemq.ActiveMqSubscriber;
import generic.activemq.ActiveMqRedundantSubscriber;
import generic.hornetq.HornetQSubscriber;
import generic.rabbitmq.RabbitMqSubscriber;
import generic.spread.SpreadSubscriber;

public class SubscriberMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Subscriber subscriber = new SubscriberClient();

		String system = args[0];


		if (system.equalsIgnoreCase("ActiveMQ")) {
			// ActiveMQ
			String url = args[1];
			ActiveMqSubscriber activeMqSubscriber = new ActiveMqSubscriber(subscriber, url);		
			//ActiveMqRedundantListener activeMqListener = new ActiveMqRedundantListener(listener);
		} else if (system.equalsIgnoreCase("ActiveMQRedundant")) {
			// ActiveMQRedundant
			String url1 = args[1];
			String url2 = args[2];
			ActiveMqRedundantSubscriber activeMqSubscriber = new ActiveMqRedundantSubscriber(subscriber, url1, url2);
		} else if (system.equalsIgnoreCase("RabbitMQ")) {
			// RabbitMQ
			RabbitMqSubscriber rabbitMqSubscriber = new RabbitMqSubscriber(subscriber);
		} else if (system.equalsIgnoreCase("HornetQ")) {
			// HornetQ
			String url = args[1];
			int port = Integer.parseInt(args[2]);
			HornetQSubscriber hornetQSubscriber = new HornetQSubscriber(subscriber, url, port);
		} else if (system.equalsIgnoreCase("Spread")) {
			// Spread
			SpreadSubscriber spreadSubscriber = new SpreadSubscriber(subscriber);
		}
		
		try {
			while( true )
			{
				Thread.sleep(10000);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
	}

}
